package org.dream.zt;

import java.util.List;

import org.dream.domain.RisewidthResult;
import org.dream.persistence.DayDealDAO;
import org.dream.persistence.DaydealPersistenceImpl;
import org.dream.util.UUID;

/**
 * 
 * @author qiuriyuchen E-mail:panpan_001@126.com
 */
public class RisewidthResultServiceImpl implements RisewidthResultService {
	DayDealDAO dayDealDAO = new DaydealPersistenceImpl();
	RisewidthResultDAO risewidthResultDAO = new RisewidthResultDAOImpl();

	public List<RisewidthResult> findRisewidthResults(double risewidth) {
		List<RisewidthResult> results = risewidthResultDAO.findRisewidthResults(risewidth);
		if (null == results || results.size() == 0) {
			results = dayDealDAO.calRisewidthResult(risewidth);
			for (RisewidthResult risewidthResult : results) {
				risewidthResult.setId(UUID.getUUID());
			}
			risewidthResultDAO.saveList(results);
		}

		return results;
	}
}
